package week07.data_obs4;


import java.util.Observable;
import java.util.Observer;

/**
 * Created by Daniel on 2018/3/13.
 */
public class Watcher implements Observer {

    public Watcher(Observable o) {
        o.addObserver(this);
    }

    public void update(Observable o, Object arg) {  //拉的方式
        Subject subject = (Subject) o;
        System.out.println("状态改变:" + subject.getData());
    }
}
